import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import removeConsole from "vite-plugin-remove-console";
import zipPack from "vite-plugin-zip-pack";
import { nameTow, version } from "./package.json";

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    react(),
    removeConsole(),
    zipPack({ outDir: "dist", outFileName: `${nameTow}${version}.zip` }),
  ],
  server: {
    host: "0.0.0.0",
    port: 3000, // 可以根据需要设置端口，默认是3000
  },
  build: {
    minify: "terser",
    terserOptions: {
      compress: {
        drop_console: true, //打包后不显示console.log
      },
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        silenceDeprecations: ["legacy-js-api"],
      },
    },
  },
});
